<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function*itheimaGenerator(){
            console.log('itheimaGenerator执行啦');
            yield 'it'
            yield 'heima'
            yield '666'
        }
        const itheima =itheimaGenerator()
        
        /** itheima.next()
         * itheimaGenerator执行啦
        {value: 'it', done: false}
        itheima.next()
        {value: 'heima', done: false}
        itheima.next()
        {value: '666', done: false}
        itheima.next()
        {value: undefined, done: true}**/

        for(let iterator of itheima){
            console.log(iterator);
        }
        // itheimaGenerator执行啦
        // it
        //  heima
        // 666
    </script>
</body>
</html>